package com.maduar.mybatis.demo.vo;

import org.apache.ibatis.jdbc.SQL;

/**
 * Description:
 *
 * @author maduar maduar@163.com
 * @date 2021-03-31 23:11
 */
public class SqlBuilder {

    public static String buildGetUsersByName(final String name) {
        return new SQL(){{
            SELECT("*");
            FROM("users");
            if (name != null) {
                WHERE("name like #{value} || '%'");
            }
            ORDER_BY("id");
        }}.toString();
    }

}
